package edu.ubb.scrumster.model.model;

import java.util.List;

public class UserStory implements AbstractModel{
	int id;
	Sprint sprint;
	String description;
	List<Task> tasks;

	public UserStory(Sprint sprint, String description) {
		super();
		this.sprint = sprint;
		this.description = description;
	}

	public Sprint getSprint() {
		return sprint;
	}

	public void setSprint(Sprint sprint) {
		this.sprint = sprint;
	}

	public UserStory(int id, Sprint sprint, String description) {
		super();
		this.id = id;
		this.sprint = sprint;
		this.description = description;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public List<Task> getTasks() {
		return tasks;
	}

	public void setTasks(List<Task> tasks) {
		this.tasks = tasks;
	}

	public String getObjectType() {
		return "UserStory";
	}

	public void validate() throws ModelException{
		if (this.sprint==null){
			throw new ModelException("There is no sprint");
		}
		if (this.description.equals("") || this.description.isEmpty()){
			throw new ModelException("The task description is empty");
		}
	}

}
